<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let i;
        for (i = 1; i <= 3; i++) {
            setTimeout(() => {
                console.log(i);
            }, 0);
        }
        // 444 和作用域和自由变量的关系？ let定义的是块级作用域
        // 我认为是和同步异步的关系比较大。


        let a = 100;
        function test() {
            alert(a);//100
            a = 10;
            alert(a);//10
        }
        test()
        alert(a);//10

        let b = 1;
        function test2() {
            let b = 2;
            alert(b);//2
        }
        test2();
        alert(b); //1
    </script>
</body>

</html>